package com.thug.tools;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Convenience datasource allowing to log when a connection is opened.
 * 
 * @author THUGUERRE
 */
public class MyBasicDataSource extends org.apache.commons.dbcp.BasicDataSource {

	private static final Log LOGGER = LogFactory.getLog(MyBasicDataSource.class);
	
	public Connection getConnection() throws SQLException {
		LOGGER.info("Opening connection");
		return new MyConnection(super.getConnection());
	}
}
